<?php
// +----------------------------------------------------------------------
// | Leaps Framework [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2011-2014 Leaps Team (http://www.tintsoft.com)
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author XuTongle <xutongle@gmail.com>
// +----------------------------------------------------------------------
namespace Module\System\Controller;

use Leaps\Web\Controller;
use Leaps\Kernel;

class IndexController extends Controller
{
	private $http;

	/**
	 * 首页
	 */
	public function indexAction()
	{
		echo '测试系统';

		exit;
		$s = new \Leaps\Socket(['host'=>'whois.iana.org','port'=>43]);
		$s->write("aaa.net\r\n");
		$r = $s->read();
		print_r($r);
		// $this->http = $this->get('httpclient');
		// print_r ( Kernel::$app->get ( 'httpclient' )->get ( "http://www.baidu.com" ) );

		exit;
		$ip = "l68.net";
		$whois = $this->get_whois_from_server ( "whois.verisign-grs.com", $ip );
		print_r ( $whois );
		exit ();
		$baidu = $this->http->get ( "http://www.baidu.com" );
		print_r ( $baidu );
		echo 9999;
		// print_r($this->view);
		// return $this->response;
	}

	/**
	 * Get the whois content of an ip by selecting the correct server
	 */
	function get_whois($ip)
	{
		$w = $this->get_whois_from_server ( 'whois.iana.org', $ip );

		preg_match ( '@whois\.[\w\.]*@si', $w, $data );
		return $w;
		$whois_server = $data [0];

		// echo $whois_server;

		// now get actual whois data
		$whois_data = $this->get_whois_from_server ( $whois_server, $ip );

		return $whois_data;
	}



	/**
	 * Alexa走势图
	 */
	public function alexaAction()
	{
		$a = "http://traffic.alexa.com/graph?w=500&h=280&r=3m&y=r&u=www.baidu.com";
		$b = "http://traffic.alexa.com/graph?w=500&h=280&r=3m&y=t&u=www.qq.com";
		$c = "http://traffic.alexa.com/graph?w=700&h=280&r=6m&y=t&u=l68.net";
	}
}